#ifndef OBSTACLE_H_
#define OBSTACLE_H_

#include "CSurface.h"
#include "Character.h"

#include "Animation.h"
#include "AnimationVolcan.h"
#include <SDL/SDL.h>
#include <vector>

using namespace std;

class Obstacle {
    protected:
        float w;
        float h;

    public:
        float position[3];
        SDL_Surface* surface;

        Obstacle(int x, int y, int z=0, int w=62, int h=70);

        /** Pinta el obstaculo */
        virtual void OnRender(SDL_Surface* display);

        /**
         * Dado un segemento de recta, verifica si esta
         * colisiona con el obstaculo.
         *
         * @param current Almacena el punto donde el Character
         *    deberia estar depues de la colicion
         * @param I   Indica en que punto choco el character
         *            con el obstaculo
         * @param N   Vector normal al choque
         * @return bool que indica si el character choco con este
         */
        bool collideWith(Character*c,
            float **current, float **I, float **N);
        bool collideWith(float p[3], float vel[3],
            float **current, float **I, float **N);
};

class ObstacleVolcan: public Obstacle {
    public:
        Animation* a;
        Uint32 old_time;
        bool off;
        ObstacleVolcan(int x, int y, int z=0, int w=84, int h=157);
        /** Pinta el obstaculo */
        void OnRender(SDL_Surface* display);
};

class ObstacleMuro : public Obstacle {
    public:
        ObstacleMuro(int x, int y, int z=0, int w=62, int h=70);

        /** Pinta el obstaculo */
        void OnRender(SDL_Surface* display);
};

extern vector<Obstacle*>  obstacle;

#endif
